abstract class Data {
    abstract public void DisplayValue();
}

class Integer extends  Data {
    int value;
    Integer() {
        value=535;
    }
    public void DisplayValue(){
        System.out.println (value);
    }
}
class Double extends  Data {
    double value1;
    Double() {
        value1=535.123456789123;
    }
    public void DisplayValue(){
        System.out.println (value1);
    }
}

abstract class Factory {
    abstract public Data CreateDataObject();
}
class IntFactory extends Factory {
    public Data CreateDataObject(){
        return new Integer();
    }
}
class DoubleFactory extends Factory {
    public Data CreateDataObject(){
        return new Double();
    }
}

class Document {
    Data pd;
    Document(Factory pf){
        pd = pf.CreateDataObject();
    }
    public void DisplayData(){
        pd.DisplayValue();
    }
}

public class MyDoc {
    static Document c;
    public static void main(String[] args) {
        c = new Document(new DoubleFactory());
        c.DisplayData();
    }
}